﻿using System;
using System.Html.DOM;

namespace jQueryLib
{
    public partial class JQueryInstance
    {
        /// <summary>
        /// Create a deep copy of the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Clone();

        /// <summary>
        /// Create a deep copy of the set of matched elements.
        /// </summary>
        /// <param name="withDataAndEvents">A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well.</param>
        /// <returns></returns>
        public abstract JQueryInstance Clone(bool withDataAndEvents);

        /// <summary>
        /// Create a deep copy of the set of matched elements.
        /// </summary>
        /// <param name="withDataAndEvents">A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well.</param>
        /// <param name="deepWithDataAndEvents">A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).</param>
        /// <returns></returns>
        public abstract JQueryInstance Clone(bool withDataAndEvents, bool deepWithDataAndEvents);

        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        /// <param name="wrappingElement">An HTML snippet, selector expression</param>
        /// <returns></returns>
        public abstract JQueryInstance Wrap(string wrappingElement);

        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Wrap(JQueryInstance instance);

        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Wrap(HtmlElement element);

        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A callback function returning the HTML content to wrap around the matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Wrap(Func<string, int> func);

        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A callback function returning jQuery object to wrap around the matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Wrap(Func<JQueryInstance, int> func);

        /// <summary>
        /// Wrap an HTML structure around all elements in the set of matched elements.
        /// </summary>
        /// <param name="wrappingElement">An HTML snippet, selector expression specifying the structure to wrap around the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapAll(string wrappingElement);

        /// <summary>
        /// Wrap an HTML structure around all elements in the set of matched elements.
        /// </summary>
        /// <param name="instance">A jQuery object specifying the structure to wrap around the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapAll(JQueryInstance instance);

        /// <summary>
        /// Wrap an HTML structure around all elements in the set of matched elements.
        /// </summary>
        /// <param name="element">A DOM element specifying the structure to wrap around the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapAll(HtmlElement element);

        /// <summary>
        /// Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Unwrap();

        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        /// <param name="wrappingElement">An HTML snippet, selector expression specifying the structure to wrap around the content of the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapInner(string wrappingElement);

        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        /// <param name="instance">A jQuery object specifying the structure to wrap around the content of the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapInner(JQueryInstance instance);

        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        /// <param name="element">A DOM element specifying the structure to wrap around the content of the matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance WrapInner(HtmlElement element);

        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A callback function which generates a structure to wrap around the content of the matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance WrapInner(Func<JQueryInstance, int> func);

        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A callback function which generates a structure to wrap around the content of the matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance WrapInner(Func<string, int> func);

        /// <summary>
        /// Set the content of each element in the set of matched elements to the specified text.
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public abstract JQueryInstance Text(string text);

        /// <summary>
        /// Set the content of each element in the set of matched elements to the specified text.
        /// </summary>
        /// <param name="func">string function(index, oldtext)</param>
        /// <returns></returns>
        public abstract JQueryInstance Text(Func<string, int ,string> func);

        /// <summary>
        /// Get the combined text contents of each element in the set of matched elements, including their descendants.
        /// </summary>
        /// <returns></returns>
        public abstract string Text();

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="htmlSnippet"></param>
        /// <returns></returns>
        public abstract JQueryInstance Append(string htmlSnippet);

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance Append(JQueryInstance instance);

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance Append(HtmlElement element);

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns an HTML string to insert at the end of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Append(Func<string, int, string> func);

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns a jQuery object to insert at the end of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Append(Func<JQueryInstance, int, string> func);

        /// <summary>
        /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns a DOM element(s) to insert at the end of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Append(Func<HtmlElement, int, string> func);

        /// <summary>
        /// Insert every element in the set of matched elements to the end of the target.
        /// </summary>
        /// <param name="selector">A selector, the matched set of elements will be inserted at the end of the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance AppendTo(string selector);

        /// <summary>
        /// Insert every element in the set of matched elements to the end of the target.
        /// </summary>
        /// <param name="element">An html element, will be inserted at the end of the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance AppendTo(HtmlElement element);

        /// <summary>
        /// Insert every element in the set of matched elements to the end of the target.
        /// </summary>
        /// <param name="instance">A jQuery object, will be inserted at the end of the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance AppendTo(JQueryInstance instance);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="htmlSnippet">HTML string to insert at the beginning of each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(string htmlSnippet);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="instance">jQuery object to insert at the beginning of each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(JQueryInstance instance);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="element">DOM element to insert at the beginning of each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(HtmlElement element);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns an HTML string to insert at the beginning of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(Func<string, int, string> func);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns a DOM element to insert at the beginning of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(Func<HtmlElement, int, string> func);

        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns  jQuery object to insert at the beginning of each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Prepend(Func<JQueryInstance, int, string> func);

        /// <summary>
        /// Insert every element in the set of matched elements to the beginning of the target.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrependTo(string selector);

        /// <summary>
        /// Insert every element in the set of matched elements to the beginning of the target.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrependTo(JQueryInstance instance);

        /// <summary>
        /// Insert every element in the set of matched elements to the beginning of the target.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance PrependTo(HtmlElement element);

        /// <summary>
        /// Remove the set of matched elements from the DOM.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Detach();

        /// <summary>
        /// Remove the set of matched elements from the DOM.
        /// </summary>
        /// <param name="selector">A selector expression that filters the set of matched elements to be removed.</param>
        /// <returns></returns>
        public abstract JQueryInstance Detach(string selector);

        /// <summary>
        /// Remove all child nodes of the set of matched elements from the DOM.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Empty();

        /// <summary>
        /// Remove the set of matched elements from the DOM.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance Remove();

        /// <summary>
        /// Remove the set of matched elements from the DOM.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance Remove(string selector);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="htmlSnippet">HTML string to insert after each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance After(string htmlSnippet);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="element">DOM element to insert after each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance After(HtmlElement element);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="instance">jQuery object to insert after each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance After(JQueryInstance instance);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns an HTML string to insert after each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance After(Func<string, int> func);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns DOM element(s) to insert after each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance After(Func<HtmlElement, int> func);

        /// <summary>
        /// Insert content, specified by the parameter, after each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns jQuery object to insert after each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance After(Func<JQueryInstance, int> func);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="htmlSnippet">HTML string to insert before each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Before(string htmlSnippet);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="element">DOM element to insert before each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Before(HtmlElement element);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="instance">jQuery object to insert before each element in the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance Before(JQueryInstance instance);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns jQuery object to insert before each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Before(Func<string, int> func);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns DOM element(s) to insert before each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Before(Func<HtmlElement, int> func);

        /// <summary>
        /// Insert content, specified by the parameter, before each element in the set of matched elements.
        /// </summary>
        /// <param name="func">A function that returns a jQuery object to insert before each element in the set of matched elements.
        /// <para>Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Before(Func<JQueryInstance, int> func);

        /// <summary>
        /// Insert every element in the set of matched elements after the target.
        /// </summary>
        /// <param name="selector">A selector, the matched set of elements will be inserted after the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertAfter(string selector);

        /// <summary>
        /// Insert every element in the set of matched elements after the target.
        /// </summary>
        /// <param name="element">An element will be inserted after the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertAfter(HtmlElement element);

        /// <summary>
        /// Insert every element in the set of matched elements after the target.
        /// </summary>
        /// <param name="instance">A jQuery object will be inserted after the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertAfter(JQueryInstance instance);

        /// <summary>
        /// Insert every element in the set of matched elements before the target.
        /// </summary>
        /// <param name="selector">A selector, the matched set of elements will be inserted before the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertBefore(string selector);

        /// <summary>
        /// Insert every element in the set of matched elements before the target.
        /// </summary>
        /// <param name="element">An element will be inserted before the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertBefore(HtmlElement element);

        /// <summary>
        /// Insert every element in the set of matched elements before the target.
        /// </summary>
        /// <param name="instance">A jQuery object will be inserted before the element(s) specified by this parameter.</param>
        /// <returns></returns>
        public abstract JQueryInstance InsertBefore(JQueryInstance instance);

        /// <summary>
        /// Replace each target element with the set of matched elements.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceAll(string selector);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="htmlSnippet"></param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(string htmlSnippet);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(HtmlElement element);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="instance"></param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(JQueryInstance instance);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="func">A function that returns content with which to replace the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(Func<string, int> func);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="func">A function that returns DOM element(s) with which to replace the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(Func<HtmlElement, int> func);

        /// <summary>
        /// Replace each element in the set of matched elements with the provided new content.
        /// </summary>
        /// <param name="func">A function that returns jQuery instance with which to replace the set of matched elements.</param>
        /// <returns></returns>
        public abstract JQueryInstance ReplaceWith(Func<JQueryInstance, int> func);
    }
}
